/*
 * 
 *  $Author: nfelipe$
 * 
 *  Copyright (c) 2011 by PROS Revenue Management.  All Rights Reserved.
 *  This software is the confidential and proprietary information of
 *  PROS Revenue Management ("Confidential Information").
 *  You shall not disclose such Confidential Information and shall use it
 *  only in accordance with the terms of the license agreement you entered
 *  into with PROS.
 * 
 */

package javaapplication2;

/**
 *
 * @author Nestor Felipe
 */

public class Pixel{
    private int x, y;

    public Pixel(){
        this(0, 0);
    }

    public Pixel(int x, int y){
        this.x = x;
        this.y = y;
    }

    public Pixel(Pixel pixel){
        this.x = pixel.getX();
        this.y = pixel.getY();
    }

    public int getX() {
        return x;
    }

    public int getY() {
        return y;
    }

    public boolean isNegative(){
        return x < 0 || y < 0;
    }

    @Override
    public boolean equals(Object obj_pixel){
        
        if(this == obj_pixel)
            return true;
        
        if(!(obj_pixel instanceof Pixel))
            return false;
        
        Pixel pixel = (Pixel)obj_pixel;
        return this.x == pixel.getX() && this.y == pixel.getY();
    }

    @Override
    public int hashCode() {
        int hash = 3;
        hash = 79 * hash + this.x;
        hash = 79 * hash + this.y;
        return hash;
    }
}